import axios from 'axios'
const instance = axios.create({
  baseURL: 'http://localhost:3000',
  timeout: 3000,
})

// 请求拦截器
instance.interceptors.request.use(
  (config) => {
    const token = localStorage.getItem('token')
    if (token) config.headers.Authorization = `Bearer ${token}`
    return config
  },
  (error) => {
    return Promise.reject(error)
  }
)


export default instance
